package net.dopan.pigframe.demo.service;

import net.dopan.pigframe.core.base.service.BaseService;
import net.dopan.pigframe.demo.model.entity.UserDemo;
import org.springframework.cache.annotation.CacheEvict;
import org.springframework.cache.annotation.Cacheable;

import java.util.List;
import java.util.Map;

public interface HomepageService extends BaseService<UserDemo> {

    /** 判断两者是否为好友关系 */
    Boolean checkRelationship(String userId,String friendId);
    /** 判断是否关注对方 */
    Boolean checkConcern(String userId,String friendId);
    /** 添加关注 */
   Integer addConcern(String userId,String friendId);
    /**
     * 添加关注
     */
    @CacheEvict(cacheNames = "CONCERNFANS", key="'getFriends'+#userId")
    void concernUser(String userId, String concernUserId);
    /** 判断是否为粉丝 */
    Boolean checkFans(String userId,String friendId);
    /** 添加粉丝 */
    Integer addFans(String userId,String friendId);
    /** 获取好友 */
    @Cacheable(cacheNames = "CONCERNFANS",key="'getFriends'+#userId")
    Map<String, List> getFriends(String userId);
    /** 获取好友动态 */
    List<Map<String, String>> getUserEvents(String userId, Integer offset, Integer limit);

}
